#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n,m,a,b;
	cin>>n>>m>>a>>b;
	double cost1,cost2;
	cost1 = 1.0*a;
	cost2 = (1.0*b)/(1.0*m);
	if(cost1<=cost2) cout<<n*a<<endl;
	else 
	{
		int cnt = n/m;
		int mod = n%m;
		if(mod==n&&b<=n*a) cout<<b<<endl;
		else
		{
			int ans = cnt*b;
			cout<<ans+min(b,mod*a)<<endl;
		}
	}
} 
